<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>demo</title>
	<style type="text/css">
		body{
			margin: 100px;
		}
		*{
			margin: 0px;
			padding: 0px;
			text-decoration: none;
			list-style: none;
		}
		.main{
			width: 1220px;
			height: 460px;
			border:1px solid #ccc;
			position: relative;
			overflow: hidden;
		}
		.main .a1{
			position: absolute;
			left: 0px;
			top: 0px;

		}
		.main .a2{
			position: absolute;
			left: 1220px;
			top: 0px;
		}
		.bott {
			width: 1220px;
			height: 60px;
			position:absolute;
			top: 400px;
			left: 0px;
		}
		p{
			width: 1220px;
			height: 60px;
			position: absolute;
			background-color: #333;
			/*opacity: 0.5;*/
			background-color: rgba(0,0,0,0.3);
		}
		.sm{
			display: block;
			width: 1220px;
			height: 60px;
			line-height: 60px;
			color: #fff;
			text-align: center;
			position: absolute;
			z-index: 2;
		}
		.main img{
			width: 1220px;
			height: 460px;
		}
		ul{
			position: absolute;
			top:50%;
			left: 50%;
			/*margin-top: ;*/
		}
		li{
			width: 20px;
			height: 20px;
			border-radius: 50%;
			float: left;
			background-color: #ccc;
			margin: 5px;
			
		}
	</style>
	<script type="text/javascript">
		window.onload=function(){
			img1=document.getElementsByClassName("a1")[0];
			img2=document.getElementsByClassName("a2")[0];
			main=document.getElementsByClassName("main")[0];
			bott=document.getElementsByClassName("bott")[0];
			sp=document.getElementsByClassName("sm")[0];
			pp=document.getElementsByTagName("p")[0];
			list=document.getElementsByTagName("li");
			// alert(list[0]);
			arr=["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg"];
			arrlen=arr.length;
			a=0;
			b=1;
			timer=null;
			timer1=null;
			
			img1.src=arr[a];
			img2.src=arr[b];

			for(i=0;i<list.length;i++){
				dj(i);

			}
			function dj(x){
				list[x].onclick=function(){
					clearInterval(timer);
					a=x;
					b=x+1;
					if(a>=arrlen)a-=arrlen;
					if(b>=arrlen)b-=arrlen;
					img1.src=arr[a];
					img2.src=arr[b];
					console.log(a+""+b);
					timer=setInterval(bd, 70);
				}
			}
			timer=setInterval(bd, 70);
			function bd(){
				len1=parseInt(getStyle(img1,'left'))-10;
				len2=parseInt(getStyle(img2,'left'))-10;
				img1.style.left=len1+"px";
				img2.style.left=len2+"px";
				if(len1==-1220){
					a+=2;
					if(a>=arrlen)a-=arrlen;
					img1.style.left=1220+"px";
					img1.src=arr[a];
				}
				if(len2==-1220){
					b+=2;
					if(b>=arrlen)b-=arrlen;
					img2.style.left=1220+"px";
					img2.src=arr[b];
				}

			}


			function getStyle(obj,str){return obj.currentStyle?obj.currentStyle[str]:getComputedStyle(obj)[str];}
		}

	</script>
</head>
<body>
	<div class="main">
		<img src="" alt="" class="a1">
		<img src="" alt="" class="a2">
		<div class="bott">
		<span class="sm">
			<ul>
				<li></li>
				<li></li>
				<li></li>
				<li></li>
				<li></li>
			</ul>
		</span>
		<p></p>
	</div>
	</div>
		
</body>
</html>